// TFXQXEGWNOJVWOVE

let nodemailer = require("nodemailer")

async function sendEmail() {
	let transporter = ndoemailer.createTransport({
		host: "smtp.163.com",
		port: 465,
		secure: true,
		auth: {
			user: "liangzhenmengvip@163.com", // generated ethereal user
			pass: "TFXQXEGWNOJVWOVE" // generated ethereal password
		}
	})
	let info = {
		from: "liangzhenmeng@163.com",
		to: sendEmail.email,
		subject: "邮箱验证码",
		html: "<b>您的验证码为<i>789345</i>,打死都不要转发给别人哦</b>"
	}
	transporter.sendEmail(info)
}


async function main() {
	// create reusable transporter object using the default SMTP transport
	let transporter = nodemailer.createTransport({
		host: "smtp.163.com",
		port: 465,
		secure: true, // true for 465, false for other ports
		auth: {
			user: "liangzhenmengvip@163.com", // generated ethereal user
			pass: "TFXQXEGWNOJVWOVE" // generated ethereal password
		}
	});

	// send mail with defined transport object
	let info = {
		from: '"liangzhenmengvip@163.com', // sender address
		to: "liangzhenmeng@126.com", // list of receivers
		subject: "Hello ✔", // Subject line
		html: "<b>我使用nodemailer给你发送了邮箱</b>" // html body
	}

	let i = 43;
	info.to = "954735560@qq.com";
	subject = "结婚邀请函";
	info.html = "我们结婚的第"+ i +"年";
	transporter.sendMail(info,(err,data)=>{
		console.log(err,data);
		if(err){
			console.log(err)
		}else {
			if (i>50) return;
			i++;
			info.to = "954735560@qq.com";
			subject = "结婚邀请函";
			info.html = "我们结婚的第"+ i +"年";
			transporter.sendMail(info);
		}
	});

}

main().catch(console.error);